﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace quickfileindexer.Components
{
    public partial class SearchForm : Form
    {
        public SearchForm()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if(textBox2.Text != "") new FileIndexer().Search(this.textBox1.Text,this.textBox2.Text);
            else new FileIndexer().Search(this.textBox1.Text);
        }

        private void SearchForm_Load(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            new FileIndexer().Update();
            this.label3.ForeColor = Color.Green;
            this.label3.Text = "* Refresh complete.";
            button2.Text = "Refresh";
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            this.label3.ForeColor = Color.Red;
            this.label3.Text = "* To search files with extension .docx, type \"docx\".";
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            this.label3.ForeColor = Color.Red;
            this.label3.Text = "* Provide a extension to search more precisely.";
        }
    }
}
